package controller

import (
	"denglibin.io/common/util"
	"github.com/gin-gonic/gin"
	"go.web.demo.com/api/entity"
	"go.web.demo.com/api/pojo"
	"go.web.demo.com/web/model"
	"go.web.demo.com/web/rpc_client"
)

//用户接口路由配置
func UserRoute(g *gin.RouterGroup) {
	g.GET("/userInfo", userInfo)
	g.GET("/rpcUser", rpcUser)
}

//获取用户信息
func userInfo(c *gin.Context) {
	//panic(errors.New("测试error")) //测试错误捕捉
	SuccessJson(c, model.Success(&entity.User{Id: 1, Name: "李四", CreateTime: util.GetNowDateTimeString()}))
}

//远程调用
func rpcUser(c *gin.Context) {
	u := rpc_client.QueryUser(&pojo.UserPram{})
	SuccessJson(c, model.Success(u))
}
